﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Xejen.Database
{
    /// <summary>
    /// 表示活动的数据库连接/数据库事务提供器
    /// </summary>
    /// <creator>marc</creator>
    public interface IActiveTransactionProvider
    {
        /// <summary>
        /// 获取活动的数据库事务
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        Task<IDbTransaction> GetActiveTransactionAsync(ActiveTransactionProviderArgs args);

        /// <inheritdoc cref="GetActiveTransactionAsync(ActiveTransactionProviderArgs)"/>
        IDbTransaction GetActiveTransaction(ActiveTransactionProviderArgs args);

        /// <summary>
        /// 获取活动的数据库连接
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        Task<IDbConnection> GetActiveConnectionAsync(ActiveTransactionProviderArgs args);

        /// <inheritdoc cref="GetActiveConnectionAsync(ActiveTransactionProviderArgs)"/>
        IDbConnection GetActiveConnection(ActiveTransactionProviderArgs args);
    }
}
